import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase="DBshop024_删除商品评价"
comment="下次还是会回顾"

firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text("我的订单").click()
firefox.find_element_by_partial_link_text("交易完成").click()
firefox.find_element_by_link_text("尚未评价").click()
firefox.find_element_by_id("comment_body").send_keys(comment)
firefox.find_element_by_xpath("//button").click()

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"商品管理","商品评价")
firefox.find_element_by_link_text("编辑查看").click()

firefox.find_element_by_link_text("删除")
firefox.switch_to_alert().accept()

try:
    firefox.find_element_by_xpath("//td[text()='%s']"%comment)
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)


